//
//  SearchBtn.swift
//  Mall-swift
//
//  Created by Bob on 2020/10/17.
//  Copyright © 2020 Bob. All rights reserved.
//

import UIKit

public class SearchBtn: UIButton {
    public override func layoutSubviews() {
        super.layoutSubviews()
        
        guard let imageView = self.imageView, let titleLabel = self.titleLabel else {return}
        
        var labF = titleLabel.frame
        var imgF = imageView.frame
        
        let btnF = frame
        let lRMargin: CGFloat = 16
        let labImgMargin: CGFloat = 10


        imgF.origin.x =  CGFloat(lRMargin)
        
        
        imgF.origin.y = (btnF.height - imgF.height) * 0.5
        imageView.frame = imgF
        labF.origin.x = CGFloat(imgF.maxX + labImgMargin)

        labF.origin.y = (btnF.height - labF.height) * 0.5
        titleLabel.frame = labF
    }
}
